/************************************************************************/
/*Copyright (c) James Zhao 2007,2008
/*This file is part of AdminOverlay.
/*AdminOverlay is free software: you can redistribute it and/or modify
/*it under the terms of the GNU General Public License as published by
/*the Free Software Foundation, either version 3 of the License, or
/*(at your option) any later version.
/*
/*AdminOverlay is distributed in the hope that it will be useful,
/*but WITHOUT ANY WARRANTY; without even the implied warranty of
/*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
/*GNU General Public License for more details.
/*
/*You should have received a copy of the GNU General Public License
/*along with AdminOverlay.  If not, see <http://www.gnu.org/licenses/>.                                                                     */
/*************************************************************************/
#pragma once

#include "Player.h"
#include "dllutils_svr.h"
#include <vector>
#include "windows.h"

using namespace std;
enum BanSystem
{
	BanSystem_Default,
	BanSystem_PunkBuster
};
enum SessionType
{
	SessionType_XMLRPC,
};

//abstract interface
class ServerSession
{
public:	 
	static ServerSession* createServerSession
		(SessionType sessionType, LPCTSTR ip, int port, LPCTSTR password);
public:
	ServerSession(LPCTSTR pIP, int pPort, LPCTSTR pPassword);
	virtual ~ServerSession(void);
public:
	virtual void Connect() = 0;
	virtual void Disconnect() = 0;
	virtual void Reset() = 0;
	virtual bool TestConnection() = 0;
public:
	LPCTSTR IP() const;
	void IP(LPCTSTR val);
	LPCTSTR Password() const;
	void Password(LPCTSTR val);
	int Port() const;
	void Port(int val); 
	bool IsConnected() const;
public:
	virtual LPCTSTR ExecuteCommand(LPCTSTR command) = 0;
	virtual void Say(LPCTSTR textToSay) = 0;
	virtual LPCTSTR GetStatus() = 0;
	virtual vector<Player*>* GetPlayers() = 0;	
	virtual void Ban(Player player) = 0;
	virtual void Kick(Player player) = 0;
protected:
	LPCTSTR ip;
	int port;
	LPCTSTR password;
	void IsConnected(bool val);
	BanSystem banSystem;
private:
	bool isConnected;
};
